package versi.vitro.oaiserviceprovider.application;

import org.jmock.Expectations;
import org.jmock.Mockery;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;

import versi.vitro.oaiserviceprovider.application.VitroOAIProvider;
import versi.vitro.oaiserviceprovider.model.ExportableModelGenerator;
import versi.vitro.oaiserviceprovider.service.exporter.api.ExporterService;

public class VitroOAIProviderTest {

    private Mockery context;

    @BeforeMethod
    public void setUp() {
	context = new Mockery();
    }

    @Test
    public void testStartApplication() {

	final ExportableModelGenerator andsJenaManager = context.mock(ExportableModelGenerator.class);
	context.checking(new Expectations() {
	    {
		oneOf(andsJenaManager).generateExportModel();
	    }
	});

	final ExporterService exporterService = context.mock(ExporterService.class);
	context.checking(new Expectations() {
	    {
		oneOf(exporterService).generateXmlFile();
	    }
	});

	VitroOAIProvider vitroOAIProvider = new VitroOAIProvider(andsJenaManager, exporterService);
	vitroOAIProvider.startApplication();

	context.assertIsSatisfied();
    }
}
